/**
 * 联系人路由
 * 处理联系人相关的API请求
 */
const express = require('express');
const router = express.Router();
const { protect } = require('../middleware/authMiddleware');
const {
  getContacts,
  addContact,
  removeContact,
  searchContacts,
  getOrCreateConversation
} = require('../controllers/contactController');

// 路由配置
router.route('/')
  .get(protect, getContacts); // 获取所有联系人

router.route('/add')
  .post(protect, addContact); // 添加联系人

router.route('/search')
  .get(protect, searchContacts); // 搜索联系人

router.route('/conversation')
  .post(protect, getOrCreateConversation);

router.route('/:contactId')
  .delete(protect, removeContact); // 删除联系人

module.exports = router; 